<template>
  <el-dialog title="分组重命名" :visible.sync="$attrs.visableIf" @close="handleCloseDialog" :close-on-click-modal="false" :close-on-press-escape="false" append-to-body width="500px">
    <el-form ref="form" :rules="rules" :model="form" label-width="120px">
      <el-form-item label="分组名称：" prop="name">
        <div class="item-big">
          <el-input v-model="form.name" placeholder="请输入分组名称"></el-input>
        </div>
      </el-form-item>
    </el-form>
    <div class="footer-btn" slot="footer">
      <el-button type="primary" @click="handleCloseDialog">取消</el-button>
      <el-button @click="onSubmit('form')">提交</el-button>
    </div>
  </el-dialog>
</template>

<script>
export default {
  name: 'editName',
  components: {},
  data() {
    return {
      form: {
        name: null,
      },
      rules: {
        'name': [
          {required: true, message: '请输入标签名称', trigger: 'blur'}
        ],

      },
    }
  },
  created() {
  },
  mounted() {
  },
  watch: {},
  methods: {
    onSubmit(formName) {
      //提交的代码
      this.$refs[formName].validate((valid) => {
        if (valid) {
          console.log('提交表单');
        } else {
          console.log('error submit!!');
          return false;
        }
      });
    },
    handleCloseDialog() {
      this.$emit('update:visableIf', false);
      this.$emit('handleQuery');
    }
  }
}
</script>

<style scoped lang="scss">
.footer-btn {
  display: flex;
  justify-content: flex-end;
}

.item-li {
  padding: 16px;
  background: #f7f7f7;
  border-radius: 2px;

  .el-radio-group {
    margin-bottom: 10px;
  }
}

::v-deep .el-dialog__body {
  overflow-y: auto;

  .el-form-item {
    border: none !important;

    .el-form-item__label {
      padding-bottom: 0px
    }

    .item-big {
      display: flex;

      .el-button--medium {
        padding: 0px 10px;
        margin-left: 20px;
      }
    }
  }
}

</style>
